package com.qire.manhua.model.po;

import java.util.Date;

import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.Index;
import androidx.room.PrimaryKey;

// 建立索引，并设置成唯一键，可以防止重复写入，如果插入模式为 @Insert(onConflict = OnConflictStrategy.REPLACE) 则会使用最新记录的替换
@Entity(indices = {@Index(value = {"searchWords"}, unique = true)} )
public class SearchHistoryRecord {

    @PrimaryKey(autoGenerate = true)//主键是否自动增长，默认为false
    private int id;

    private String searchWords;

    private Date createTime = new Date();

    public SearchHistoryRecord() {}

    @Ignore
    public SearchHistoryRecord(String searchWords) {
        this.searchWords = searchWords;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getSearchWords() {
        return searchWords;
    }

    public void setSearchWords(String searchWords) {
        this.searchWords = searchWords;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
